package com.ruoyi.tb.lmt.mapper;

import com.ruoyi.tb.lmt.domain.TbLmtrepairWorkdetail;
import com.ruoyi.tb.lmt.domain.bo.TbLmtrepairWorkdetailBo;
import com.ruoyi.tb.lmt.domain.vo.*;
import com.ruoyi.common.core.mapper.BaseMapperPlus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 检修工作Mapper接口
 *
 * @author ruoyi
 * @date 2023-12-14
 */
@Mapper
public interface TbLmtrepairWorkdetailMapper extends BaseMapperPlus<TbLmtrepairWorkdetailMapper, TbLmtrepairWorkdetail, TbLmtrepairWorkdetailVo> {

    List<TbLmtrepairWorkdetailVo> selectByRepairId(@Param("id") String id, @Param("status") String status,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("repairChar") String repairChar);

    List<TbLmtrepairWorkdetailVo> selectWorkByRepairId(@Param("id") String id, @Param("status") String status, @Param("workKind") String workKind,
                                                       @Param("workCategory") String workCategory, @Param("workName") String workName,
                                                       @Param("workRequire") String workRequire, @Param("workGroup") String workGroup);

    List<TbLmtrepairWorkdetailVo> selectDispatchByRepairId(@Param("id") String id, @Param("status") String status,
                                                           @Param("workGroupId") Long workGroupId ,@Param("lmtType")String lmtType,
                                                           @Param("lmtNumber") String lmtNumber,@Param("workKind") String workKind,@Param("repairChar") String repairChar);

    //查询部门的还有看到本部门下子部门
    List<TbLmtrepairWorkdetailVo> selectDispatchByRepairIdAndDeptIds(@Param("id") String id, @Param("status") String status,
                                                                     @Param("deptIds") List<Long> deptIds, @Param("lmtType") String lmtType,
                                                                     @Param("lmtNumber") String lmtNumber, @Param("workKind") String workKind, @Param("repairChar") String repairChar);

    List<TbLmtrepairWorkdetailVo> selectOverhaulByRepairId(@Param("id") String id, @Param("status") String status,
                                                           @Param("workUser") String workUser,@Param("deptIds") List<Long> deptIds ,
                                                           @Param("lmtType")String lmtType,@Param("lmtNumber") String lmtNumber,
                                                           @Param("repairChar") String repairChar,@Param("workCategory")String workCategory);

    List<TbLegacyIssuesVo> selectLegacyByRepairId(@Param("id") String id,@Param("deptIds") List<Long> deptIds ,@Param("lmtType")String lmtType,@Param("lmtNumber") String lmtNumber,@Param("repairChar") String repairChar);

    //
    List<TbLmtrepairWorkdetailVo> selectCheckByRepairId(@Param("id") String id,@Param("deptIds") List<Long> deptIds ,@Param("lmtType")String lmtType,@Param("lmtNumber") String lmtNumber,@Param("repairChar") String repairChar);

    List<TbLmtrepairWorkdetailVo> selectApprovalByRepairId(@Param("id") String id,@Param("workGroupId") Long workGroupId,@Param("workSelect")String workSelect ,@Param("lmtType")String lmtType,@Param("lmtNumber") String lmtNumber,@Param("repairChar") String repairChar);

    List<TbLmtrepairWorkdetailVo> selectWorkHistoryList(@Param("id") String id, @Param("workKind") String workKind, @Param("workGroup")String workGroup , @Param("status")String status, @Param("startTime") Date startTime);

    Map<String, Object> queryMapById(Long id);

    //通过id查信息
    TbLmtrepairWorkdetailVo selectWorkInfo(Long id);

    List<TbLmtrepairWorkdetailVo> selectTaskAllById(@Param("lmtRepairId")String lmtRepairId,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("status") String status,@Param("repairChar") String repairChar);

    List<TbLmtrepairWorkdetailVo> selectLegacyById(@Param("lmtRepairId")String lmtRepairId,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("status") String status,@Param("repairChar") String repairChar);

    String selectTaskAllCount(Long lmtRepairId);

    String selectFinishAllCount(Long lmtRepairId);

    String selectLegacyIssuesCount(Long lmtRepairId);

    List<TbLmtrepairWorkdetailVo> selectMutualById(@Param("lmtRepairId")String lmtRepairId,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("status") String status,@Param("repairChar") String repairChar);

    String selectWorkNeed(Long lmtRepairId);

    List<TbLmtrepairWorkdetailVo> selectSpecialById(@Param("lmtRepairId")String lmtRepairId,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("status") String status,@Param("repairChar") String repairChar);

    TbLmtrepairWorkdetailVo selectWorkDetail(Long lmtRepairId);

    boolean checkIfExist(Long lmtRepairId);

    String selectWorkNeed2(Long lmtRepairId);

    List<TbLmtrepairWorkdetailVo> selectAcceptanceById(@Param("lmtRepairId")String lmtRepairId,@Param("lmtType") String lmtType,@Param("lmtNumber") String lmtNumber,@Param("status") String status,@Param("repairChar") String repairChar);

    Boolean isFinishByLmtId(@Param("lmtRepairId")String lmtRepairId);

    Boolean isIssuesByLmtId(@Param("lmtRepairId")String lmtRepairId);

    List<TbLmtrepairWorkdetailVo> selectIndexTest(@Param("lmtType")String lmtType, @Param("lmtNumber") String lmtNumber
        , @Param("workType") String workType, @Param("workGroup") String workGroup, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    List<TbLmtrepairWorkdetailVo> selectIndexNotTest(@Param("lmtType")String lmtType,@Param("lmtNumber") String lmtNumber
        ,@Param("workType") String workType,@Param("workGroup") String workGroup, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    String selectMessageCount(@Param("workUser")String workUser,@Param("startRequireDate") Date startRequireDate);

    String selectNotFinish(@Param("workUser")String workUser,@Param("startRequireDate") Date startRequireDate);

    String selectNotIssued(@Param("workGroup")String workGroup,@Param("startRequireDate") Date startRequireDate);

    String selectNotStartVo(@Param("workUser")String workUser);

    String selectNotFinishVo(@Param("workUser")String workUser);

    List<TbLmtrepairWorkdetailVo> selectWorkInfoList(Long id);

    List<TbLmtrepairWorkdetailVo> selectMessageUser(@Param("startRequireDate")Date startRequireDate);

    String findGroupLeaderByWorkGroup(@Param("workGroup")String workGroup);

    String selectMessageCountByGroup(@Param("workGroup")String workGroup,@Param("startRequireDate") Date startRequireDate);

    List<IssuesVo> selectIssuesById(Long lmtRepairId);

    List<FormDataVo> selectFormDataById(Long lmtRepairId);

    List<TbWorkFileVo> selectWorkFileById(Long lmtRepairId);


    List<TbLmtrepairWorkdetailVo> selectIssuesWorkList(@Param("lmtType") String lmtType,
                                                       @Param("lmtNumber") String lmtNumber, @Param("workType") String workType,
                                                       @Param("workUser") String workUser, @Param("startRequireDate") Date startRequireDate);

    List<TbLmtrepairWorkdetailVo> selectPickupList();

    String selectAllCount(@Param("deptIds") List<Long> deptIds);

    String selectNotStartCount(@Param("deptIds") List<Long> deptIds);

    String selectNotFinishCount(@Param("deptIds") List<Long> deptIds);

    String selectFinishCount(@Param("deptIds") List<Long> deptIds);

    String selectIssuesCount(@Param("deptIds") List<Long> deptIds);

    List<TbLmtrepairWorkdetailVo> selectAllCountList(@Param("deptIds") List<Long> deptIds);

    List<TbLmtrepairWorkdetailVo> selectNotStartCountList(@Param("deptIds") List<Long> deptIds);

    List<TbLmtrepairWorkdetailVo> selectNotFinishCountList(@Param("deptIds") List<Long> deptIds);

    List<TbLmtrepairWorkdetailVo> selectFinishCountList(@Param("deptIds") List<Long> deptIds);

    List<TbLmtrepairWorkdetailVo> selectIssuesCountList(@Param("deptIds") List<Long> deptIds);

    List<DeptVo> selectDeptVoList();

    List<DeptVo> selectUserList(Long deptId);

    TbLmtrepairWorkdetailVo selectWorkDetailData(@Param("equipmentName") String equipmentName, @Param("lmtRepairId") Long lmtRepairId);

    TbLmtrepairWorkdetailBo selectWorkInfoBo(Long id);

    int selectIssuedCount(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
    int selectCompletedCount(@Param("startTime") Date startTime, @Param("endTime") Date endTime);

    String selectNotReleased(String id);

    String selectReleased(String id);

    String selectAllCountById(@Param("id")String id, @Param("workUser")String workUser, @Param("deptIds") List<Long> deptIds);

    String selectNotStartCountById(@Param("id")String id, @Param("workUser")String workUser, @Param("deptIds") List<Long> deptIds);

    String selectNotFinishCountById(@Param("id")String id, @Param("workUser")String workUser, @Param("deptIds") List<Long> deptIds);

    String selectFinishCountById(@Param("id")String id, @Param("workUser")String workUser, @Param("deptIds") List<Long> deptIds);

    TbLmtrepairWorkdetailBo selectByMutual(Long lmtRepairId);

    String selectUserIssuesCount(String workUser);

    List<TbLegacyIssuesVo> selectUserIssuesWorkList(String workUser);

    TbLmtrepairWorkdetailBo selectBySpecial(Long lmtRepairId);

    TbLmtrepairWorkdetailBo selectByAcceptance(Long lmtRepairId);

    List<TbLmtrepairWorkdetailVo> selectWorkByRepairId1(
        @Param("status") String status,
        @Param("workKind") String workKind,
        @Param("workCategory") String workCategory,
        @Param("workName") String workName,
        @Param("workRequire") String workRequire,
        @Param("workGroup") String workGroup,
        @Param("workType") String workType);

    int countByWeekAndWorkType(@Param("date") LocalDate date, @Param("workType") String workType);

    TbLmtrepairWorkdetailVo selectByLmtTypeLmtNumberWorkCategoryWorkCategoryId(@Param("lmtType") String lmtType,
                                                                               @Param("lmtNumber") String lmtNumber,
                                                                               @Param("workCategory") String workCategory,
                                                                               @Param("workCategoryId") String workCategoryId,
                                                                               @Param("status")String status);

    TbLmtrepairWorkdetail selectByLmtNumberAndCategory(@Param("lmtNumber") String lmtNumber, @Param("category") String category);

    TbLmtrepairWorkdetailVo selectTopOneByLmtNumberAndRepairChar(@Param("lmtNumber") String lmtNumber, @Param("workType") String workType);

    List<TbLmtrepairWorkdetailVo> queryListAndNotIds(@Param("like") String like, @Param("like1") String like1, @Param("ids") List<String> ids);

    void updateByRepairIdsAndCategoryAndKind(@Param("workdetail") TbLmtrepairWorkdetail workdetail, @Param("repairIds") List<Long> repairIds);
    void updateByRepairIdsAndCategoryAndKind1(@Param("workdetail") TbLmtrepairWorkdetail workdetail, @Param("repairIds") List<Long> repairIds);

    String selectFinishCountById1(@Param("id") String id);

    String selectInWorkCount(@Param("id") String id);

    int deleteByLmtRepairId(@Param("lmtRepairId") Long lmtRepairId);

    List<TbLmtrepairWorkdetailVo> queryByLmtRepairId(@Param("lmtRepairId")Long lmtRepairId);
}
